import request from '@/utils/request'

// 获取点位总数
export const vmCount = () => request.get('/api/vm-service/node/count')

// 合作商点位汇总统计
export const nodeCollect = () => request.get('/api/vm-service/node/nodeCollect')

// 获取售货机货道详情
export const channelList = innerCode => request.get(`/api/vm-service/channel/channelList/${innerCode}`)

// 区域列表
export const vmSearch = params => request.get('/api/vm-service/region/search', { params })

// 新增区域
export const vmRegion = data => request.post('/api/vm-service/region', data)

// 点位搜索
export const vmNodeSearch = params => request.get('/api/vm-service/node/search', { params })

// 修改区域
export const vmPutRegion = (id, data) => request.put(`/api/vm-service/region/${id}`, data)

// 删除区域
export const delRegion = id => request.delete(`/api/vm-service/region/${id}`)

// 新增点位
export const vmNode = data => request.post('/api/vm-service/node', data)

// 商圈列表
export const businessType = () => request.get('/api/vm-service/businessType')

// 点位详情
export const vmList = id => request.get(`/api/vm-service/node/vmList/${id}`)

// 删除点位
export const delNode = id => request.delete(`/api/vm-service/node/${id}`)

// 合作商搜索
export const partnerSearch = params => request.get('/api/user-service/partner/search', { params })

// 修改区域
export const vmPutNode = (id, data) => request.put(`/api/vm-service/node/${id}`, data)

// 搜索售货机(售货机列表)
export const vmSearchList = (params) => request.get('/api/vm-service/vm/search', { params })

// 策略搜索
export const policySearch = (params) => request.get('/api/vm-service/policy/search', { params })

// 新增策略
export const addPolicy = data => request.post('/api/vm-service/policy', data)

// 修改策略
export const putPolicy = (id, data) => request.put(`/api/vm-service/policy/${id}`, data)

// 根据策略搜索售货机
export const policyVmList = (id, params) => request.get(`/api/vm-service/policy/vmList/${id}`, { params })

// 删除策略
export const delPolicy = id => request.delete(`/api/vm-service/policy/${id}`)

// 获取商品管理

export const VmThings = (pageIndex, pageSize) => request.get(`api/vm-service/sku/search?pageIndex=${pageIndex}&pageSize=${pageSize}`)

// 商品查询

export const lookThing = (pageIndex, pageSize, skuName) => request.get(`api/vm-service/sku/search?pageIndex=${pageIndex}&pageSize=${pageSize}&skuName=${skuName}`)

// 获取商品类型

export const ThingAge = () => request.get('api/vm-service/skuClass/search?pageIndex=1&pageSize=100000')

// 新建商品

export const getNewThing = (data) => request.post('api/vm-service/sku', data)

// 修改商品

export const changeThing = params => request.put(`api/vm-service/sku/${params.skuId}`, params)
// 获取商品类型
export const objectType = (params) => request.get('/api/vm-service/skuClass/search', { params })

// 商品类型新建接口
export const addObject = (data) => request.post('/api/vm-service/skuClass', data)

// 商品类型修改接口
export const changeObject = (id, data) => request.put(`/api/vm-service/skuClass/${id}`, data)

// 商品查询接口
export const searchObject = (params) => request.get('/api/vm-service/skuClass/search', { params })
// Zhongw
// 设备管理接口
export const deviceManage = (page) => request.get(`/api/vm-service/vm/search?pageIndex=${page}&pageSize=10`)

// 头部查询接口
export const deviceSearch = (innerCode) => request.get(`api/vm-service/vm/search?pageIndex=1&pageSize=10&innerCode=${innerCode}`)

// 选择策略接口
export const selectPolicy = () => request.get('/api/vm-service/policy')

// 选择点位接口
export const selectSite = () => request.get('/api/vm-service/vmType/search?pageIndex=1&pageSize=100000')

// 新建接口
export const create = (data) => request.post('/api/vm-service/vm', {
  createUserId: data.id,
  nodeId: data.type,
  vmType: data.site
})

// 批量操作接口
export const operation = (data) => request.put('/api/vm-service/vm/applyPolicy', {
  innerCodeList: data.innderCodeList,
  policyId: data.policyId
})

// 查看策略接口
export const getStrategy = (id) => request.get(`/api/vm-service/policy/vmPolicy/${id}`)

// 取消策略接口
export const cancleStrategy = (code, id) => request.put(`/api/vm-service/vm/cancelPolicy/${code}/${id}`)

// 设备点位
export const deviceSite = () => request.get('/api/vm-service/node/search?pageIndex=1&pageSize=100000')

// 修改接口
export const changeDevice = (id, nodeId) => request.put(`/api/vm-service/vm/${id}/${nodeId}`)

// 销售机接口
export const deviceType = (id) => request.get(`api/vm-service/vmType/${id}`)

// 货道商品接口
export const getGoods = (code) => request.get(`/api/vm-service/channel/channelList/${code}`)

// 地点类型接口
export const getSiteType = (id) => request.get(`/api/vm-service/businessType/name/${id}`)

// top10接口
export const getTop10 = (id) => request.get(`/api/vm-service/sku/businessTop10/${id}`)

// 商品查询接口
export const goodsSearch = (name) => request.get(`/api/vm-service/sku/search?pageIndex=1&pageSize=10&skuName=${name}`)

// 点击添加触发的接口
export const addGoodsList = (name) => request.get('/api/vm-service/sku/search?pageIndex=1&pageSize=10')

// 最后大成接口
export const putSuccess = (data) => request.put('/api/vm-service/channel/channelConfig', data)

// 设备类型管理接口

// table接口
export const getDeviceType = (page) => request.get(`/api/vm-service/vmType/search?pageIndex=${page}&pageSize=10`)

// 查询接口
export const searchType = (name) => request.get(`/api/vm-service/vmType/search?pageIndex=1&pageSize=10&name=${name}`)

// 图片上传接口
export const imgUpload = (data) => request.post('/api/vm-service/sku/fileUpload', data)

// 新建接口
export const newCreate = (data) => request.post('https://likede2-admin.itheima.net/likede/api/vm-service/vmType', {
  channelMaxCapacity: data.num,
  image: data.image,
  model: data.code,
  name: data.name,
  vmCol: data.col,
  vmRow: data.row
})

// 修改接口
export const edit = (data) => request.put(`/api/vm-service/vmType/${data.typeId}`, data)
